# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at https://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from django.utils.translation import ugettext_lazy as _

from pipeline.component_framework.component import Component

from . import base
from .add_or_update_hosts import AddOrUpdateHostsService
from .bind_host_agent import BindHostAgentService
from .check_agent_ability import CheckAgentAbilityService
from .check_agent_status import CheckAgentStatusService
from .check_policy_gse_to_proxy import CheckPolicyGseToProxyService
from .choose_access_point import ChooseAccessPointService
from .configure_policy import ConfigurePolicyService
from .get_agent_status import GetAgentStatusService
from .install import InstallService
from .install_other_agent import InstallOtherAgentService
from .install_plugins import InstallPluginsService
from .push_agent_pkg_to_proxy import PushAgentPkgToProxyService
from .push_environ_files import PushEnvironFilesService
from .push_files_to_proxy import PushFilesToProxyService
from .push_host_identifier import PushIdentifierHostsService
from .push_upgrade_package import PushUpgradeFileService
from .query_password import QueryPasswordService
from .register_host import RegisterHostService
from .reload_agent_config import ReloadAgentConfigService
from .render_and_push_gse_config import RenderAndPushGseConfigService
from .restart import RestartService
from .run_upgrade_command import RunUpgradeCommandService
from .unbind_host_agent import UnBindHostAgentService
from .update_install_info import UpdateInstallInfoService
from .update_process_status import UpdateProcessStatusService
from .upgrade_to_agent_id import UpgradeToAgentIDService
from .wait import WaitService


class QueryPasswordComponent(Component):
    name = _("查询主机密码")
    code = "query_password"
    bound_service = QueryPasswordService


class ChooseAccessPointComponent(Component):
    name = _("选择接入点")
    code = "choose_access_point"
    bound_service = ChooseAccessPointService


class RegisterHostComponent(Component):
    name = _("注册主机到配置平台")
    code = "register_host_to_cmdb"
    bound_service = RegisterHostService


class InstallComponent(Component):
    name = _("安装")
    code = "install"
    bound_service = InstallService


class InstallPluginsComponent(Component):
    name = _("安装预设插件")
    code = "install_plugins"
    bound_service = InstallPluginsService


class ConfigurePolicyComponent(Component):
    name = _("配置策略")
    code = "configure_policy"
    bound_service = ConfigurePolicyService


class GetAgentStatusComponent(Component):
    name = _("查询Agent状态")
    code = "get_agent_status"
    bound_service = GetAgentStatusService


class ReloadAgentConfigComponent(Component):
    name = _("重载Agent配置")
    code = "reload_agent_config"
    bound_service = ReloadAgentConfigService


class RestartComponent(Component):
    name = _("重启")
    code = "restart"
    bound_service = RestartService


class UpdateProcessStatusComponent(Component):
    name = _("更新主机进程状态")
    code = "update_process_status"
    bound_service = UpdateProcessStatusService


class CheckAgentStatusComponent(Component):
    name = _("检查Agent状态")
    code = "agent_check_agent_status"
    bound_service = CheckAgentStatusService


class PushUpgradePackageComponent(Component):
    name = _("下发升级包")
    code = "push_upgrade_package"
    bound_service = PushUpgradeFileService


class CheckPolicyGseToProxyComponent(Component):
    name = _("检测 GSE Server 到 Proxy 策略")
    code = "check_policy_gse_to_proxy"
    bound_service = CheckPolicyGseToProxyService


class RunUpgradeCommandComponent(Component):
    name = _("下发升级脚本命令")
    code = "run_upgrade_command"
    bound_service = RunUpgradeCommandService


class RenderAndPushGseConfigComponent(Component):
    name = _("渲染并下发Agent配置")
    code = "render_and_push_gse_config"
    bound_service = RenderAndPushGseConfigService


class WaitComponent(Component):
    name = _("等待")
    code = "wait"
    bound_service = WaitService


class AgentExecuteScriptComponent(Component):
    name = _("执行脚本")
    code = "agent_execute_script"
    bound_service = base.AgentExecuteScriptService


class AgentTransferFiletComponent(Component):
    name = _("分发文件")
    code = "agent_transfer_file"
    bound_service = base.AgentTransferFileService


class AgentPushConfigComponent(Component):
    name = _("分发配置")
    code = "agent_push_config"
    bound_service = base.AgentPushConfigService


class PushFilesToProxyComponent(Component):
    name = _("下发文件到Proxy")
    code = "push_files_to_proxy"
    bound_service = PushFilesToProxyService


class UpdateInstallInfoComponent(Component):
    name = _("更新安装信息")
    code = "update_install_info"
    bound_service = UpdateInstallInfoService


class BindHostAgentComponent(Component):
    name = _("绑定主机 Agent 信息")
    code = "bind_host_agent"
    bound_service = BindHostAgentService


class UnBindHostAgentComponent(Component):
    name = _("主机解绑 Agent 信息")
    code = "unbind_host_agent"
    bound_service = UnBindHostAgentService


class AddOrUpdateHostsComponent(Component):
    name = _("新增或更新主机信息")
    code = "add_or_update_hosts"
    bound_service = AddOrUpdateHostsService


class UpgradeToAgentIDComponent(Component):
    name = _("升级为 Agent-ID 配置")
    code = "upgrade_to_agent_id"
    bound_service = UpgradeToAgentIDService


class PushIdentifierHostsComponent(Component):
    name = _("推送主机身份信息")
    code = "push_host_identifier"
    bound_service = PushIdentifierHostsService


class PushAgentPkgToProxyComponent(Component):
    name = _("下发 Agent 安装包到 Proxy")
    code = "push_agent_pkg_to_proxy"
    bound_service = PushAgentPkgToProxyService


class CheckAgentAbilityComponent(Component):
    name = _("检查Agent功能")
    code = "check_agent_ability"
    bound_service = CheckAgentAbilityService


class PushEnvironFilesComponent(Component):
    name = _("推送环境变量文件")
    code = "push_environ_files"
    bound_service = PushEnvironFilesService


class InstallOtherAgentComponent(Component):
    name = _("安装额外Agent")
    code = "install_other_agent"
    bound_service = InstallOtherAgentService
